package com.flycat.service.impl;

import com.flycat.common.enumeration.SysRoleEnum;
import com.flycat.core.AbstractService;
import com.flycat.dao.mapper.SysPermissionMapper;
import com.flycat.dao.po.SysPermission;
import com.flycat.service.SysPermissionService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;


/**
 * Created by yalei.chen on 2017/09/28.
 */
@Service
@Transactional
public class SysPermissionServiceImpl extends AbstractService<SysPermission> implements SysPermissionService {
    @Resource
    private SysPermissionMapper sysPermissionMapper;

    @Override
    public List<SysPermission> findByRole(SysRoleEnum role) {

        return sysPermissionMapper.selectByRole(role.getCode());
    }

    @Override
    public List<SysPermission> findMenusByRole(SysRoleEnum role) {

        return sysPermissionMapper.selectMenusByRole(role.getCode());
    }
}
